package buffer;


/**
 * The {@link ConstantSource} class is a {@link Source} that always returns the value it was created with.
 */
public class ConstantSource<T> implements Source<T>{

	private final T value;

	private T getValue() {
		return this.value;
	}
	/**
	 * Constructor of {@link ConstantSource}.
	 * @param value is the value this buffer provides on the get() operation.
	 */
	public ConstantSource(final T value) {
		this.value = value;
	}

	@Override
	public T get() {
		return this.getValue();
	}
	@Override
	public boolean isConstant() {
		return true;
	}
}
